﻿using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {        
        SimDSTableAdapters.SimTableAdapter simAdapter = new SimDSTableAdapters.SimTableAdapter();

        if (Request.QueryString["MID"] != null) {            
            GridView1.DataSourceID = "SqlDataSource2";
            //GridView1.DataSource = simAdapter.GetDataByMID(int.Parse(Request.QueryString["MID"]));
           
        }
        else if (Request.QueryString["TID"] != null) {
            GridView1.DataSourceID = "SqlDataSource3";
            //GridView1.DataSource = simAdapter.GetDataByTID(int.Parse(Request.QueryString["TID"]));
            
        }
        else if (Request.QueryString["q"] != null) {
            GridView1.DataSourceID = "SqlDataSource4";
            //GridView1.DataSource = simAdapter.GetDataSearchBy(Request.QueryString["q"]);
            
        }
        else if (Request.QueryString["p"] != null) {
            GridView1.Visible = false;
            if (Request.QueryString["p"] == "lh")
                Panel1.Visible = true;
            else
                Panel2.Visible = true;

        }
        else if (Request.QueryString["help"] != null) {
            GridView1.Visible = false;
            HelpPanel.Visible = true;
        }
        else
            GridView1.DataSourceID = "SqlDataSource1";
        GridView1.DataBind();
        

    }
    protected void SearchButton_Click(object sender, EventArgs e) {
        if (SearchTextBox.Text != "")
            Response.Redirect("~/Default.aspx?q=" + SearchTextBox.Text);
    }
    
}
